package o;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.RestrictTo;
import androidx.annotation.RestrictTo.d;
import java.util.ArrayList;
import o.bo.b;

@RestrictTo({d.LIBRARY_GROUP})
public abstract class be implements bn {
    public bo ʻ;
    private int ʼ;
    private bn.d ʽ;
    public bd ˊ;
    protected LayoutInflater ˋ;
    protected LayoutInflater ˎ;
    protected Context ˏ;
    protected Context ॱ;
    private int ॱॱ;
    private int ᐝ;

    public abstract void ॱ(bj bjVar, b bVar);

    public be(Context context, int i, int i2) {
        this.ॱ = context;
        this.ˋ = LayoutInflater.from(context);
        this.ʼ = i;
        this.ᐝ = i2;
    }

    public void ˏ(Context context, bd bdVar) {
        this.ˏ = context;
        this.ˎ = LayoutInflater.from(this.ˏ);
        this.ˊ = bdVar;
    }

    public bo ˏ(ViewGroup viewGroup) {
        if (this.ʻ == null) {
            this.ʻ = (bo) this.ˋ.inflate(this.ʼ, viewGroup, false);
            this.ʻ.ˎ(this.ˊ);
            ˊ(true);
        }
        return this.ʻ;
    }

    public void ˊ(boolean z) {
        ViewGroup viewGroup = (ViewGroup) this.ʻ;
        if (viewGroup != null) {
            int i;
            if (this.ˊ != null) {
                this.ˊ.ˊॱ();
                ArrayList ʽ = this.ˊ.ʽ();
                int size = ʽ.size();
                int i2 = 0;
                i = 0;
                while (i2 < size) {
                    int i3;
                    bj bjVar = (bj) ʽ.get(i2);
                    if (ˏ(i, bjVar)) {
                        View childAt = viewGroup.getChildAt(i);
                        bj ˏ = childAt instanceof b ? ((b) childAt).ˏ() : null;
                        View ˏ2 = ˏ(bjVar, childAt, viewGroup);
                        if (bjVar != ˏ) {
                            ˏ2.setPressed(false);
                            ˏ2.jumpDrawablesToCurrentState();
                        }
                        if (ˏ2 != childAt) {
                            ˋ(ˏ2, i);
                        }
                        i3 = i + 1;
                    } else {
                        i3 = i;
                    }
                    i2++;
                    i = i3;
                }
            } else {
                i = 0;
            }
            while (i < viewGroup.getChildCount()) {
                if (!ॱ(viewGroup, i)) {
                    i++;
                }
            }
        }
    }

    protected void ˋ(View view, int i) {
        ViewGroup viewGroup = (ViewGroup) view.getParent();
        if (viewGroup != null) {
            viewGroup.removeView(view);
        }
        ((ViewGroup) this.ʻ).addView(view, i);
    }

    protected boolean ॱ(ViewGroup viewGroup, int i) {
        viewGroup.removeViewAt(i);
        return true;
    }

    public void ˎ(bn.d dVar) {
        this.ʽ = dVar;
    }

    public bn.d ˋ() {
        return this.ʽ;
    }

    public b ˎ(ViewGroup viewGroup) {
        return (b) this.ˋ.inflate(this.ᐝ, viewGroup, false);
    }

    public View ˏ(bj bjVar, View view, ViewGroup viewGroup) {
        b bVar;
        if (view instanceof b) {
            bVar = (b) view;
        } else {
            bVar = ˎ(viewGroup);
        }
        ॱ(bjVar, bVar);
        return (View) bVar;
    }

    public boolean ˏ(int i, bj bjVar) {
        return true;
    }

    public void ˏ(bd bdVar, boolean z) {
        if (this.ʽ != null) {
            this.ʽ.ॱ(bdVar, z);
        }
    }

    public boolean ˎ(bv bvVar) {
        if (this.ʽ != null) {
            return this.ʽ.ˎ(bvVar);
        }
        return false;
    }

    public boolean ˏ() {
        return false;
    }

    public boolean ˏ(bd bdVar, bj bjVar) {
        return false;
    }

    public boolean ˎ(bd bdVar, bj bjVar) {
        return false;
    }

    public int ॱ() {
        return this.ॱॱ;
    }

    public void ॱ(int i) {
        this.ॱॱ = i;
    }
}
